//
//  JMMainViewController.m
//  仿生物无忧
//
//  Created by 彭继宗 on 15/12/5.
//  Copyright © 2015年 彭继宗. All rights reserved.
//

#import "JMMainViewController.h"

@interface JMMainViewController ()

@end

@implementation JMMainViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [self addChildController];
}


/**
 *  添加子控制器的方法
 */
- (void)addChildController
{
    self.tabBar.tintColor = basicColor;
    
    //添加首页
    [self addChildViewController:[[JMHomeViewController alloc] init] andTitle:@"首页" andImgName:@"home"];
    //添加名医
    [self addChildViewController:[[JMFamousViewController alloc] init] andTitle:@"名医" andImgName:@"doctor"];
    
    //添加发现
    [self addChildViewController:[[JMMessageController alloc] init] andTitle:@"消息" andImgName:@"news"];
    
    //添加我
    [self addChildViewController:[[JMNewsController alloc] init] andTitle:@"资讯" andImgName:@"information"];
    
}

/**
 *  @author Jimmy Peng
 *
 *  定义一个设置子控制器的方法
 *
 *  @param childController 子控制器
 *  @param title           控制器名字
 *  @param name            图标名字
 */
- (void)addChildViewController:(UIViewController *)childController andTitle:(NSString *)title andImgName:(NSString *)name
{
    //赋值名字
    childController.title = title;
    
    //赋值图标
    childController.tabBarItem.image = [UIImage imageNamed:name];
    
    //包装成nav
    UINavigationController *profileNav = [[UINavigationController alloc] initWithRootViewController:childController];
    
    //
    profileNav.navigationBar.titleTextAttributes = @{UITextAttributeTextColor:[UIColor whiteColor],UITextAttributeFont:[UIFont systemFontOfSize:16]};
    
    //设置子控制器
    [self addChildViewController:profileNav];
    
    
}

#pragma mark- 设置状态栏颜色





@end
